import random

target = random.randint(1, 99)
times = 7
print('猜数字游戏开始，请猜100以内的整数')

while times != 0:
    num = int(input('请输入你要猜的数字:\n'))
    if num > target:
        print('大了\n')
        times -= 1
        continue
    elif num < target:
        print('小了\n')
        times -= 1
        continue
    else:
        print('恭喜你猜对了，正确答案是', target)
        break

if times == 0:
    print('很遗憾，你的次数用完了~')
